package DataStructureAndAlgorithm.GraphTheory.TopSort;
//链接：https://www.acwing.com/problem/content/850/
//思路：每次找出入度为0的点，并从其出发，每次减少他的一条出边，再将新出现的入度为0的点入队，直到没有入度为0的点为止
//如果最后拓扑序长度(队列的长度)小于给定点的数量，则所有存在环
//
//
//拓扑排序，只适用于有向无环图
//所有的有向无环图，都是拓扑图
import java.util.*;

class AcWing_848{
    static int N = 100010;
    static int n,m;
    static int idx;
    static int[] e = new int[N];
    static int[] ne = new int[N];
    static int[] h = new int[N];
    //d[i]：表示点i的入度
    static int[] d = new int[N];

    static int[] queue = new int[N];

    static void add(int a,int b){
        e[idx] = b;ne[idx] = h[a]; h[a] = idx++;
    }

    static boolean topSort(){
        int hh = 0;   //队头
        int tt = -1;  //队尾
        //找出所有入度为0的点作为起点入队
        for (int i = 1; i <= n; i++){
            if (d[i] == 0){
                queue[++tt] = i;
            }
        }

        while(hh <= tt){
            //队列特性，先进先出
            int t = queue[hh++];
            //遍历每一个入度为0的点的邻边
            for (int i = h[t]; i != -1; i = ne[i]){
                int j = e[i];
                //把于t点像连的边去掉
                d[j]--;
                //如果去完之后入度变为0，则入队
                if (d[j] == 0){
                    queue[++tt] = j;
                }
            }
        }

        if (tt == n - 1)return true;
        return false;
    }

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();
        Arrays.fill(h,-1);
        int a,b;
        for (int i = 0; i < m; i++){
            a = in.nextInt();
            b = in.nextInt();
            //添加一条从a指向b的边
            add(a,b);
            //b的入度加一
            d[b]++;
        }

        if (topSort()){
            for (int i = 0; i < n; i++){
                System.out.print(queue[i] + " ");
            }
        }else {
            System.out.println(-1);
        }

        in.close();
    }
}